import Ember from 'ember';

export default Ember.Controller.extend({
    statusService: Ember.inject.service("current-status"),
    addNewEva:false,
    constants: Constants,
    title:'',
    queryCondition:'',
    showpopInvitePassModal:false,
    mainController: Ember.inject.controller('business.mainpage'),
    actions:{
      addEva(){
        this.set('addNewEva',true);
      },
      saveNewEva(){
        var _self=this;
        var curUser = this.get("statusService").getUser();
        var newEva=this.store.createRecord('evaluatemodel',{});
        newEva.set('title',this.get('title'));
        newEva.set('createUser',curUser);
        newEva.set('delStatus',1);
        newEva.save().then(function(newEva){
          console.log('*-*-*-*-*-EVA SAVE SUCCESS!!-*-*-*-*-*-');
          _self.set('addNewEva',false);
          _self.set('title','');
          _self.get("mainController").switchMainPage('eva-plan-detail',{editMode:"add",id:newEva.get('id')});
        });
      },
      invitation(){
        this.set('addNewEva',false);
      },
      //跳转楼层编辑页
      goDetail(eva){
          let id=eva.get('id');
          this.get("mainController").switchMainPage('eva-plan-detail',{id:id,editMode:"edit"});
      }

    }
});
